﻿package frEngine.loaders.particleSub
{
    import frEngine.loaders.particleSub.particleInstance.*;

    public class BoxEmitter extends EmitterObject
    {
        private var _H:Number = 0;
        private var _W:Number = 0;
        private var _L:Number = 0;
        private var dx:Number;
        private var dy:Number;
        private var dz:Number;

        public function BoxEmitter(param1:Number, param2:Number, param3:Number, param4:String, param5:String)
        {
            this._W = param1;
            this._H = param2;
            this._L = param3;
            this.dx = this._W * 0.5;
            this.dy = this._H * 0.5;
            this.dz = this._L * 0.5;
            super(param4, param5);
            return;
        }// end function

        override public function get meshData() : MeshBase
        {
            if (!_meshData && !hasDisposed)
            {
                _meshData = new BoxParticle(this._W, this._H, this._L);
            }
            return _meshData;
        }// end function

        override protected function processVolume(param1:int) : void
        {
            _vect3d.x = this.dx - this._W * randnomArr0[param1];
            _vect3d.y = this.dy - this._H * randnomArr1[param1];
            _vect3d.z = this.dz - this._L * randnomArr2[param1];
            return;
        }// end function

        override protected function processAxis(param1:int) : void
        {
            _vect3d.x = 0;
            _vect3d.y = 0;
            _vect3d.z = 0;
            return;
        }// end function

        override protected function processVertex(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            var _loc_4:* = randnomArr2[param1];
            _vect3d.x = _loc_2 < 0.5 ? (-this.dx) : (this.dx);
            _vect3d.y = _loc_3 < 0.5 ? (-this.dy) : (this.dy);
            _vect3d.z = _loc_4 < 0.5 ? (-this.dz) : (this.dz);
            return;
        }// end function

        override protected function processEdage(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            var _loc_4:* = randnomArr2[param1];
            var _loc_5:* = _loc_2 * 3;
            var _loc_6:* = _loc_3 * 2;
            var _loc_7:* = _loc_4 * 2;
            if (_loc_5 < 1)
            {
                _vect3d.x = this.dx - this._W * _loc_2;
                _vect3d.y = _loc_6 < 1 ? (-this.dy) : (this.dy);
                _vect3d.z = _loc_7 < 1 ? (-this.dz) : (this.dz);
            }
            else if (_loc_5 < 2)
            {
                _vect3d.x = _loc_6 < 1 ? (-this.dx) : (this.dx);
                _vect3d.y = this.dy - this._H * _loc_2;
                _vect3d.z = _loc_7 < 1 ? (-this.dz) : (this.dz);
            }
            else
            {
                _vect3d.x = _loc_6 < 1 ? (-this.dx) : (this.dx);
                _vect3d.y = _loc_7 < 1 ? (-this.dy) : (this.dy);
                _vect3d.z = this.dz - this._L * _loc_2;
            }
            return;
        }// end function

        override protected function processCurve(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            var _loc_4:* = randnomArr2[param1];
            var _loc_5:* = _loc_2 * 3;
            var _loc_6:* = _loc_3 * 2;
            if (_loc_5 < 1)
            {
                _vect3d.x = _loc_6 < 1 ? (-this.dx) : (this.dx);
                _vect3d.y = this.dy - this._H * _loc_3;
                _vect3d.z = this.dz - this._L * _loc_4;
            }
            else if (_loc_5 < 2)
            {
                _vect3d.x = this.dx - this._W * _loc_3;
                _vect3d.y = _loc_6 < 1 ? (-this.dy) : (this.dy);
                _vect3d.z = this.dz - this._L * _loc_4;
            }
            else
            {
                _vect3d.x = this.dx - this._W * _loc_3;
                _vect3d.y = this.dy - this._H * _loc_4;
                _vect3d.z = _loc_6 < 1 ? (-this.dz) : (this.dz);
            }
            return;
        }// end function

    }
}
